﻿using System;
using System.Threading;
using System.Windows.Form.SplashScreen;
using System.Windows.Forms;

namespace ViewCam
{
    static class Program
    {
        static Mutex mutex = new Mutex(true, "View Cam");
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            if (mutex.WaitOne(TimeSpan.Zero, true))
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                SplashScreen.ShowSplashScreen();
                Application.DoEvents();
                SplashScreen.SetStatus("Loading .");
                System.Threading.Thread.Sleep(500);
                SplashScreen.SetStatus("Loading ..");
                System.Threading.Thread.Sleep(300);
                SplashScreen.SetStatus("Loading ...");
                System.Threading.Thread.Sleep(900);
                SplashScreen.SetStatus("Loading ....");
                System.Threading.Thread.Sleep(100);
                SplashScreen.SetStatus("Loading .");
                System.Threading.Thread.Sleep(400);
                SplashScreen.SetStatus("Loading ..");
                System.Threading.Thread.Sleep(50);
                SplashScreen.SetStatus("Loading ...");
                System.Threading.Thread.Sleep(240);
                SplashScreen.SetStatus("Loading ....");
                System.Threading.Thread.Sleep(900);
                SplashScreen.SetStatus("Loading .");
                System.Threading.Thread.Sleep(240);
                SplashScreen.SetStatus("Loading ..");
                System.Threading.Thread.Sleep(90);
                SplashScreen.SetStatus("Loading ...");
                System.Threading.Thread.Sleep(1000);
                SplashScreen.SetStatus("Loading ....");
                System.Threading.Thread.Sleep(100);
                SplashScreen.SetStatus("Loading .");
                System.Threading.Thread.Sleep(500);
                SplashScreen.SetStatus("Loading ..", false);
                System.Threading.Thread.Sleep(1000);
                SplashScreen.SetStatus("Loading ...", false);
                System.Threading.Thread.Sleep(1000);
                SplashScreen.SetStatus("Loading ....", false);
                System.Threading.Thread.Sleep(1000);
                SplashScreen.SetStatus("Loading .", false);
                System.Threading.Thread.Sleep(1000);
                SplashScreen.SetStatus("Loading ..");
                System.Threading.Thread.Sleep(200);
                SplashScreen.SetStatus("Loading ....");
                System.Threading.Thread.Sleep(450);
                SplashScreen.SetStatus("Loading .");
                System.Threading.Thread.Sleep(240);
                SplashScreen.SetStatus("Loading ....");
                System.Threading.Thread.Sleep(900);
                SplashScreen.CloseForm();
                Application.Run(new MainForm());
                mutex.ReleaseMutex();
            }
            else
            {
                MessageBox.Show("only one instance at a time", "View Cam");
            }
            
        }
    }
}
